/*******************************************************************************
*   			Impacts of a Large-Scale Parenting Program: 				   *
*					Experimental Evidence from Chile						   *
********************************************************************************


	REQUIRES:	"${dt_final}panel_RR_indexes.dta"
	CREATES:	${out_tables}/F1_childout_followup.xls
				
	WRITEN BY:  Italo Lopez  [italolop@usc.edu]

********************************************************************************
	Prepare data
*******************************************************************************/

	* Load data
	use "${dt_final}/panel_RR_indexes.dta", clear



/*******************************************************************************
*   Set macros for regressions
*******************************************************************************/
	
	* Outcomes
	*-----------------------------------------------------------
	local childoutcomes  "zDCCSPunt zptevir_irtscore2 zt_score zcbcl_t_e zcbcl_t_i zibatt_sspi zibatt_ssai zibatt_sssr zas_raw_score" 
	local behaviors "home_score se_score disc_score" 
	local beliefs "zpstyle1 zpstyle2 zpstyle3 zPSCS zPSSS_family zPSSS_friends zPSSS_others zPSI_Distress zCESD zpacotis"	
	local child "zptevir_irtscore2 zcog_index zsoc_index" 

	* Controls
	*-----------------------------------------------------------

	macro  def Xvar1 "i.age_year i.gender"  	
	macro  def Xvar2 "i.age_year i.gender inc_qtaut_old i.pc_edu_mdsfin hh_mem hh_tipo"  	
	macro  def Xvar2old "i.gender inc_qtaut_old i.pc_edu_mdsfin_old hh_mem hh_tipo"  

	
	* Parental characteristics: WAIS and BFI and imputed wais 
	*-----------------------------------------------------------

	macro def parent_cha4 "BFI_ext BFI_ope BFI_con BFI_neu BFI_agr wais2 flag_wais"
	
	* Plot settings 
	*--------------------------------- 
	set scheme white_tableau
	graph set window fontface "Times New Roman"
	global graph_pref "graphregion(color(white) margin(vsmall)) "

/*******************************************************************************
	Figure 1: Child Development Outcomes at Follow-up by Treatment Arm
*******************************************************************************/


	graph bar (mean) zptevir_irtscore2 zcog_index zsoc_index, /*
	*/ over(TIPO, relabel(1 "Control" 2 "NEP-B" 3 "NEP-I")) /*
	*/ legend(lab(1 "Vocabulary Index") /*
	*/ lab(2 "Executive Function Index") /* 
	*/ lab(3 "Socioemotional Index") pos(6)) /*
	*/ bar(1, color(black) lcolor(black)) /* 
	*/ bar(2, color(white) lcolor(black)) /*
	*/ bar(3, color(gs8) lcolor(black)) /*
	*/ ylab(, nogrid)	$graph_pref ytitle("ITT Impacts in SDs")
	gr export "$out_graphs/F1_childout_followup.eps", replace
	gr export "$out_graphs/F1_childout_followup.wmf", replace 


	tabstat zptevir_irtscore2 zcog_index zsoc_index, by (TIPO)
